/*----------------------------------------------------------------
 * Author:          Siqi Kang
 * Written:         02/10/2014
 * Last updated:    02/10/2014
 * 
 * The employee can be a cook or a front desk or a manager or a delivery man in 
 * the restaurant. The employee helps to manage the order. 
 * 
 *----------------------------------------------------------------*/
package JavaSource;
import java.util.*;
import java.io.*;
/**
 *
 * @author Siqi Kang
 * @version 1.0
 */
public class Employee implements Serializable,IdGenerable  {
    
   //Attributes
    private static int globalId=4000;
    private int employeeId;
    private String name;
    private int position; 
    private boolean sex; //true: male; false: female
    private String phoneNo;
    /*Current position of an employee
     * (0:cook, 1: front desk, 2: delivery man, 3: manager) */
    private String password;

    public static int getGlobalId() {
        return globalId;
    }

    public static void setGlobalId(int globalId) {
        Employee.globalId = globalId;
    }

    
    public int getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(int employeeId) {
        this.employeeId = employeeId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPosition(int position) {
        this.position = position;
    }
    
    public void setPosition(String position){
        switch(position){
            case "Cook":
                this.position = 0;
                break;
            case "Front Desk":
                this.position = 1;
                break;
            case "Delivery Man":
                this.position =2;
                break;
            case "Manager":
                this.position = 3;
                break;
        }        
    }
    
    public String getPosition(){
        String p1 = "Cook";
        String p2 = "Front Desk";
        String p3 = "Delivery Man";
        String p4 = "Manager";
        String p = "not found";
        switch(this.position){
            case 0:
                p = p1;
                break;
            case 1: 
                p = p2;
                break;
            case 2:
                p = p3;
                break;
            case 3:
                p = p4;
                break;}
        return p;
                       }

    public boolean isSex() {
        return sex;
    }

    public void setSex(boolean sex) {
        this.sex = sex;
    }

    public String getPhoneNo() {
        return phoneNo;
    }

    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }
                
    
    
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    //Constructor
    public Employee( String name, int position, boolean sex, String phoneNo, String password) {
        this.employeeId = generateId();
        this.name = name;
        this.position = position;
        this.sex = sex;
        this.phoneNo = phoneNo;
        this.password = password;
    }

    
    
    //Method
    public void updateEmployee(String name, int position, boolean sex, String phoneNo, String password){
        this.name = name;
        this.position = position;
        this.sex = sex;
        this.phoneNo = phoneNo;
        this.password = password;
    }

    @Override
    public int generateId() {
        return ++globalId;
    }
    
  

    
    
   
}
